package Demo1;

/**
 * Created with  IntelliJ IDEA .
 * Description:
 * User: lenovo
 * Date: 2025-${ MONTH }-19
 * Time: 22:05
 */
public class Computer  {
    public void PowerOn(){
        System.out.println("打开电脑");
    }
    public void PowerOff(){
        System.out.println("关闭电脑");
    }

    public void UseUsbDevice(USB usb){

        usb.OpenDevice();
        if(usb instanceof Mouse){
            Mouse mouse =(Mouse) usb;
            mouse.Click();
        }else{
            Keyboard keyBoard = (Keyboard) usb;
            keyBoard.Imput();
        }

        usb.CloseDevice();

    }
}
